package com.mall.b2c.bean;

import java.math.BigDecimal;

import com.mall.b2c.domain.delivery.DeliveryMethodDomain;
import com.mall.b2c.domain.order.OrderDomain;


/**
 * 配送方式
 * 
 * @author lzx
 *
 */
public class DeliveryMethodBean {

	private Long id; //id
	private String name; // 名称
	private String icon; // 图标
	private BigDecimal fee; // 费用
	private Boolean isDefault; //是否为默认配送方式
	private String description; // 描述

	public DeliveryMethodBean() {
	}
	
	public DeliveryMethodBean(DeliveryMethodDomain deliveryMethod, OrderDomain order) {
		if(deliveryMethod != null){
			setName(deliveryMethod.getName());
			setIcon(deliveryMethod.getIcon());
			if(order == null){
				setFee(deliveryMethod.getFirstPrice());
			}else{
				setFee(deliveryMethod.getShipFee(order.getAreaId(), order.getWeight()));
			}
			setDescription(deliveryMethod.getDescription());

			setIsDefault(deliveryMethod.getIsDefault());
		}
	}
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public BigDecimal getFee() {
		return fee;
	}

	public void setFee(BigDecimal fee) {
		this.fee = fee;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Boolean getIsDefault() {
		return isDefault;
	}

	public void setIsDefault(Boolean isDefault) {
		this.isDefault = isDefault;
	}
}
